/*
 * @Author: Leo.wang wanglizhigs@163.com
 * @Date: 2023-12-27 21:09:35
 * @LastEditors: Leo.wang wanglizhigs@163.com
 * @LastEditTime: 2024-01-06 22:05:48
 * @FilePath: /ruoyi-ui/src/filter/common.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { genders, status, types } from "@/model/options";


function optionsFilter(options, filter) {
  const { target, mate } = Object.assign({
    target: 'label',
    mate: 'value',
  }, options)
  return function (value){
    const result = options.find(item => item[mate] === value);

    return result ? result[target] : ''
  }
}
export const gender = (value) => {
	const filter = optionsFilter(genders)
  return filter(value)
}


export const type = (value) => {
	const filter = optionsFilter(types)
  return filter(value)
}


export const state = (value) => {
	const filter = optionsFilter(status)
  return filter(value)
}



